<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Upload File Use SWFUpload</title>
<script type="text/javascript" src="<%=request.getContextPath()%>/js/jquery.js"></script>
<script type="text/javascript" src="<%=request.getContextPath()%>/js/swfupload.js"></script>
<script type="text/javascript" src="<%=request.getContextPath()%>/js/swfupload.queue.js"></script>
<script type="text/javascript" src="<%=request.getContextPath()%>/js/upload.js"></script>
<link rel="stylesheet" type="text/css" href="<%=request.getContextPath()%>/css/upload.css"/>
<script type="text/javascript">
var DEBUG_MODE = true;
var SWFUPLOAD_FLASH = '<%=request.getContextPath()%>/swf/swfupload.swf';
var UPLOAD_URL = '<%=request.getContextPath()%>/batchupload?method=batchUpload';
</script>
<style type="text/css">
.hidden {display: none;}
</style>
</head>
<body>
	<div id="photos-upload">
		<form action="#" method="get" id="upload">
			<input type="hidden" value="" id="uploadFiles" name="pid" />
			<div class="upload-list hidden">
				<div class="hd">
					<span class="name">照片</span> 
					<span class="size">大小</span>
					<span class="delete">删除?</span>
				</div>
				<div class="bd">
					<fieldset class="flash" id="fsUploadProgress"></fieldset>
				</div>
			</div>
			<div id="divStatus"></div>
			<div id="upload-btn"><span id="btn_holder"></span></div>
			<div class="upload-tips"></div>
			<div id="upload-status" class="hidden">
				<span class="num">共&nbsp;<b></b>&nbsp;张</span>
				<span class="continue-wrapper">&nbsp;|&nbsp;<a href="#" class="continue">继续添加照片</a></span> 
				<span class="total-size">总计：<b></b></span>
			</div>
			<div id="has-error" class="hidden">
				<b></b>张照片上传失败。&nbsp;
				<span class="nextstep hidden">&gt;&nbsp;<a href="#">继续下一步</a>？</span>
			</div>
			<div class="opt-btns hidden">
				<input type="button" id="upload-start" value="开始上传" class="btn-green" />
				<a id="btnCancel" href="#">取消上传</a>
			</div>
			<noscript>
			<div class="message">您的浏览器不支持javascript，不能使用此页面的全部功能。
			请换用其他浏览器或者开启对javascript的支持。</div>
			</noscript>
			<div id="noflash" class="attn hidden">
				您没有安装flash播放器，或者您的flash版本不够，无法使用上传功能. 请安装最新版本的flashplayer.(<a
			href="http://fpdownload.macromedia.com/get/flashplayer/current/licensing/win/install_flash_player_10.exe">IE用户</a>/<a
			href="http://fpdownload.macromedia.com/get/flashplayer/current/install_flash_player.exe">非IE用户</a>官方下载
			)</div>
			<input id="complete" type="submit" class="hidden minisubmit" value="&gt;&nbsp;下一步,填写图片信息" />
		</form>
		<div id="old-portal">
			<br />无法上传？<a href="#">使用普通方式上传照片</a>
		</div>
	</div>
	<script> 
	    var settings = {
	        debug: DEBUG_MODE,
	        flash_url: SWFUPLOAD_FLASH,
	        file_post_name: 'file',
	        upload_url: UPLOAD_URL,
	        post_params: {
	          //  category: 'photo',
	          //  ck: get_cookie('ck'),
	          //  dbcl2: "50038793:WAdeS5/zIpE",
	            albumid: '53144779'
	        },
	        file_size_limit: '',
	        file_types: '*.jpg; *.jpeg; *.gif; *.bmp; *.png',
	        file_types_description: 'Picture Files',
	        file_upload_limit: 20,
	        file_queue_limit: 0,
	        custom_settings: {
	            progressTarget: 'fsUploadProgress',
	            cancelButtonId: 'btnCancel',
	            startButtonId: 'btnStart'
	        //    jUrl: '/j/'
	        },
	        button_placeholder_id: 'btn_holder',
	        button_width: 98,
	        button_height: 29,
	        button_image_url: '<%=request.getContextPath()%>/images/upload-btns.png',
	 
	        file_queued_handler: fileQueued,
	        file_queue_error_handler: fileQueueError,
	        file_dialog_complete_handler: fileDialogComplete,
	        upload_start_handler: uploadStart,
	        upload_progress_handler: uploadProgress,
	        upload_error_handler: uploadError,
	        upload_success_handler: uploadSuccess,
	        upload_complete_handler: uploadComplete,
	        queue_complete_handler: queueComplete,
	 
	        inimum_flash_version: '9.0.28',
	       // swfupload_pre_load_handler: preload,
	        swfupload_load_failed_handler: swfuploadLoadFailed
	    },
	 
	    oUploadBtn = $('#upload-btn'),
	    oUploadStatus = $('#upload-status'),
	    oStartUpload = $('#upload-start'),
	    oBtnCancel = $('#btnCancel'),
	    oOptBtns = $('.opt-btns'),
	    oUploadTips = $('.upload-tips'),
	    TMPL_UPLOAD_TIPS = '提示：每次最多可以<b>批量上传</b>二十张照片，按着&nbsp;“{CMD}”&nbsp;键可以一次选择多张照片';
	 
	    swfup = new SWFUpload(settings);
	 
	    oUploadBtn.show();
	    $('#uploadFiles').val('');
	 
	    // init tips
	    oUploadTips.html(TMPL_UPLOAD_TIPS.replace('{CMD}', navigator.userAgent.search('Mac') !== -1 ? 'command' : 'ctrl'));
	 
	    // cancel queue
	    oBtnCancel.click(function (e) {
	        e.preventDefault();
	        swfup.cancelQueue();
	        oOptBtns.addClass('hidden');
	        oUploadStatus.addClass('hidden');
	        oUploadBtn.removeAttr('style');
	        oStartUpload.val('开始上传').removeAttr('disabled');
	        setTimeout(function () {
	            oUploadTips.removeClass('hidden');
	        }, $.browser.msie ? 1200 : 800);
	    });
	 
	    // start upload 
	    oStartUpload.click(function () {
	        swfup.startUpload();
	    });
	 
	    // continue upload
	    oUploadStatus.find('.continue').click(function (e) {
	        e.preventDefault();
	        oUploadBtn.removeAttr('style');
	        oUploadStatus.addClass('hidden');
	    });
	 
	    $('.nextstep a').click(function (e) {
	        e.preventDefault();
	        $('#upload').submit();
	    });
	</script> 
</body>
</html>